package com.hngtrust.iir.base.service.impl;

import com.hngtrust.iir.base.entity.IndustrySw;
import com.hngtrust.iir.base.service.BaseService;
import com.hngtrust.iir.base.service.IndustrySwService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*******************************************************************************
 * Package: com.hngtrust.iir.base.service.impl
 * Type:    BaseServiceImpl
 * Date:    2021-12-8 17:13
 *
 * Copyright (c) 2021 HUANENG GUICHENG TRUST CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/

/**
 * 基础数据操作实现
 * @author Chentianyong
 * @date 2021-8-16 20:19
 */
@Service
public class BaseServiceImpl implements BaseService {
    
    @Autowired
    private IndustrySwService industrySwService;
    
    @Override
    public List<IndustrySw> listSwIndustrySub(IndustrySw industry) {
        
        String code = industry.getCode().substring(0,industry.getLevel()*2);
        industry.setCode(code);
        industry.setLevel(industry.getLevel()+1);
        List<IndustrySw> list = industrySwService.querySubList(industry);
        
        return list;
    }
}
